package provincecityarea;
import java.util.List;
import com.opensymphony.xwork2.ActionSupport;

/**
 * 控制器
 * @author Alex
 */
public class ProvinceCityAreaAction extends ActionSupport{
    private ProvinceCityAreaService pcas=new ProvinceCityAreaService();
    private Bean bean;
	public Bean getBean() {
		return bean;
	}
	public void setBean(Bean bean) {
		this.bean = bean;
	}
	 private List<String> cityList;//需要转成JSON的集合，且为其设置值
	 private List<String> areaList;
	 
	//插件会调用getXxx()方法来获取需要转成JSON的集合
	 public List<String> getListCity(){
		return cityList;		 
	 }
	 public List<String> getListArea(){
			return areaList;		 
		 }
	/**
	 * 根据省份查询城市
	 */
	public String findCityByProvince() throws Exception{
		//System.out.println(bean.getProvince());
		cityList=pcas.cityByProvince(bean.getProvince());
		
		//将List集合转成JSON文本
		return "success";	
	}
	/**
	 * 根据城市查询区域
	 */
	public String findAreaByCity() throws Exception{
		areaList = pcas.areaByCity(bean.getCity());
		//将List集合转成JSON文本
		return SUCCESS;
	}
	
	
}
